//
//  BaseTabbarViewController.m
//  HaHa
//
//  Created by 元虎的mac on 15/9/18.
//  Copyright (c) 2015年 吉亚平. All rights reserved.
//

#import "BaseTabbarViewController.h"

@interface BaseTabbarViewController ()

@end

@implementation BaseTabbarViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.tabBar.barTintColor = KBackColor;;

    [self AddChildVIewVC:[[MAINViewController alloc] init] Title:@"首页" ImageName:@"iconpng-1.png" SelectedImage:nil];
    [self AddChildVIewVC:[[FunnyViewController alloc] init] Title:@"爆笑图片" ImageName:@"图片图标.png" SelectedImage:nil];
    [self AddChildVIewVC:[[ClassIcJokeViewController alloc] init] Title:@"内涵段子" ImageName:@"text48.png" SelectedImage:nil];
    [self AddChildVIewVC:[[MineViewController alloc] init] Title:@"我的" ImageName:@"user56.png" SelectedImage:nil];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)AddChildVIewVC:(UIViewController *)ChildVC Title:(NSString *)Title ImageName:(NSString *)ImageName SelectedImage:(NSString *)SeleteImage{
    
    ChildVC.title = Title;//标题
    ChildVC.tabBarItem.image = [[UIImage imageNamed:ImageName] imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)];//默认图标    UIImageRenderingModeAlwaysOriginal阻止渲染颜色
    ChildVC.tabBarItem.selectedImage = [UIImage imageNamed:SeleteImage];//选中图标
    UINavigationController *NAVC = [[UINavigationController alloc] initWithRootViewController:ChildVC];
    ChildVC.navigationController.navigationBar.barTintColor = KBackColor;
    [self addChildViewController:NAVC];//将设置好的控制器添加到tabbar上
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
